package com.gprinter.sample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;

import com.gprinter.util.PrefName;
import com.gprinter.util.StringUtil;
import com.sample.R;

public class WelcomeActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_welcome);
        initData();
    }

    private void initData() {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent in = new Intent();
                String bluetoothAddr = PrefName.getBluetoothAddr(WelcomeActivity.this);
                if (StringUtil.isNotBlank(bluetoothAddr))
                    in.setClass(WelcomeActivity.this, WebActivity.class);
                else in.setClass(WelcomeActivity.this, HomeActivity.class);
                startActivity(in);
                finish();
            }
        }, 2000);
    }
}
